<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<meta charset="utf-8" />
<title>欢迎登录</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" />
<meta name="author" content="" />
<link th:href="@{/css/reset.css}" rel="stylesheet" />
<link th:href="@{/css/supersized.css}" rel="stylesheet" />
<link th:href="@{/css/styles.css}" rel="stylesheet" />
</head>
<body>
	<div class="page-container">
		<span style="font-size: 25px; color: #585858;">登录<span style="font-size: 12px;">/login</span></span>
		<form method="post" id="filterForm" autocomplete="off">
			<input type="text" id="username" name="username" class="username"
				placeholder="帐号" /> <input type="password" name="password"
				class="password" placeholder="密码" />
			<div style="height: 48px;">
				<p style="margin-top: 18px; color: red;"></p>
				<input class="buttons" type="button" id="but" value="确认登录" />
			</div>
		</form>
	</div>
	<script th:src="@{/js/jquery-1.8.0.js}"></script>
	<script th:src="@{/js/supersized.3.2.7.min.js}"></script>
	<script th:src="@{/js/supersized-init.js}"></script>
	<script th:src="@{/js/scripts.js}"></script>
	<script th:inline="javascript">
	$("body").keydown(function() {
         if (event.keyCode == "13") {//keyCode=13是回车键
             $('#but').click();
         }
    });
	
	$("#but").click(function() {
		var url = [[${#httpServletRequest.getContextPath()}]]+'/userLogin';
		    $.ajax({
					cache : false,
					type : "POST",
					url : url,
					async : false,
					dataType : "json",
					data : {
						username : $("#username").val(),
						password : $(".password").val()
					},
					success : function(data) {
						if(data != null){
							/* <![CDATA[ */
							if(data.success){
								window.location.href= [[${#httpServletRequest.getContextPath()}]]+'/main?userName='+data.content.userName+"&logo="+data.content.logo;
							}else{
								$("p").text(data.message);
							}
							/* ]]> */
						}
					}
	       }); 
	})
	</script>
</body>
</html>